using System;
using System.Collections.Generic;
using System.Text;

namespace WebCrawlerTools
{
    class SFilter
    {
        public static String RemoveHtmlTag(String html)
        {
            int preSPos =0;
            int sPos = html.IndexOf(SNode.HTML_TAG_S);
            int ePos = html.IndexOf(SNode.HTML_TAG_E); 
            if ((sPos == -1)||(ePos == -1)||(sPos > ePos))
            {
                return html;
            }
            StringBuilder sb = new StringBuilder();
            while ((sPos != -1)||(ePos != -1)||(sPos < ePos))
            {
                sb.Append(html.Substring(preSPos,sPos-preSPos));
                preSPos = ePos+1;
                sPos = html.IndexOf(SNode.HTML_TAG_S, preSPos);
                ePos = html.IndexOf(SNode.HTML_TAG_E, preSPos);
            }
            if (preSPos < html.Length)
            {
                sb.Append(html.Substring(preSPos));
            }
            return sb.ToString();
        }
    }
}
